from pages.base_page import BasePage
from selenium.webdriver.common.by import By


class BusinessViewPage(BasePage):
    url='/crm/index.php?m=business'
    advance_business_locator = (By.XPATH,'/html/body/div[5]/div/div[3]/ul/li[2]/a')
    click_success_advance_locator = (By.ID,'ui-id-5')
    add_product_button_locator = (By.XPATH,'/html/body/div[5]/div/div[3]/ul/li[3]/a')
    click_success_product_locator = (By.ID,'ui-id-12')
    communicate_button_locator = (By.XPATH,'/html/body/div[5]/div/div[3]/ul/li[4]/a')
    success_communicate_locator = (By.ID,'ui-id-8')
    task_button_locator = (By.XPATH,'/html/body/div[5]/div/div[3]/ul/li[5]/a')
    task_success_locator = (By.ID,'ui-id-9')
    base_info_locator = (By.XPATH,'/html/body/div[5]/div/div[1]/ul/li[2]/a')
    advance_history_locator = (By.CSS_SELECTOR,'#left_list > li:nth-child(3) > a')
    advance_history_info_locator = (By.CSS_SELECTOR,'#tab8 > div > div.pull-left.two-title')
    def click_advance_button(self):
        self.driver.find_element(*self.advance_business_locator).click()

    def click_advance_success_info(self):
        return self.driver.find_element(*self.click_success_advance_locator).text

    def click_product_button(self):
        self.driver.find_element(*self.add_product_button_locator).click()

    def click_product_success_info(self):
        return self.driver.find_element(*self.click_success_product_locator).text

    def click_communicate_button(self):
        self.driver.find_element(*self.communicate_button_locator).click()
    def click_communicate_success_info(self):
        return self.driver.find_element(*self.success_communicate_locator).text

    def click_task_button(self):
        self.driver.find_element(*self.task_button_locator).click()
    def click_task_success_info(self):
        return self.driver.find_element(*self.task_success_locator).text


    def click_base_info(self):
        self.driver.find_element(*self.base_info_locator).click()
    def click_advance_history(self):
        self.driver.find_element(*self.advance_history_locator).click()

    def click_advance_history_info(self):
        return self.driver.find_element(*self.advance_history_info_locator).text



